import pymysql

class db():
    def __init__(self,host,user,password,database):
        self.con= pymysql.connect(host=host,user=user,password=password,database=database)
        # 游标
        self.cur=self.con.cursor()

    def select(self, sql):
        # 执行sql语句
        self.cur.execute(sql)
        return self.cur.fetchall()

    def close(self):
        self.cur.close()
        self.con.close()